home *** CD-ROM | disk | FTP | other *** search
- head 1.16;
- branch ;
- access ;
- symbols ;
- locks ; strict;
- comment @# @;
-
-
- 1.16
- date 91.11.03.17.42.51; author jhh; state Exp;
- branches ;
- next 1.15;
-
- 1.15
- date 91.11.03.15.36.29; author jhh; state Exp;
- branches ;
- next 1.14;
-
- 1.14
- date 91.04.11.14.08.17; author kupfer; state Exp;
- branches ;
- next 1.13;
-
- 1.13
- date 90.11.13.11.14.27; author jhh; state Exp;
- branches ;
- next 1.12;
-
- 1.12
- date 90.10.10.13.01.27; author jhh; state Exp;
- branches ;
- next 1.11;
-
- 1.11
- date 90.02.16.13.45.33; author rab; state Exp;
- branches ;
- next 1.10;
-
- 1.10
- date 89.09.20.15.59.33; author douglis; state Exp;
- branches ;
- next 1.9;
-
- 1.9
- date 89.08.26.12.10.25; author douglis; state Exp;
- branches ;
- next 1.8;
-
- 1.8
- date 89.08.26.12.05.50; author douglis; state Exp;
- branches ;
- next 1.7;
-
- 1.7
- date 89.08.17.11.13.53; author douglis; state Exp;
- branches ;
- next 1.6;
-
- 1.6
- date 89.06.05.13.09.59; author ouster; state Exp;
- branches 1.6.1.1;
- next 1.5;
-
- 1.5
- date 89.05.22.12.30.12; author jhh; state Exp;
- branches ;
- next 1.4;
-
- 1.4
- date 89.05.21.20.43.42; author jhh; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 89.01.09.11.00.29; author ouster; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 89.01.09.10.43.46; author ouster; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 88.12.28.11.45.46; author ouster; state Exp;
- branches ;
- next ;
-
- 1.6.1.1
- date 89.08.18.11.14.33; author douglis; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.16
- log
- @didn't handle multiple -m options properly
- @
- text
- @#! /sprite/cmds/csh -f
- # Script to generate a Makefile, depending on the current directory.
- #
- # $Header: /sprite/src/cmds/mkmf.prog/RCS/mkmf,v 1.15 91/11/03 15:36:29 jhh Exp $
- #
- # The old way to prevent mkmf from working in a directory is
- # to have the comment
- # # No mkmf
- # in Makefile. This is being reversed to require a line of the form
- # # Allow mkmf
- # before mkmf will run.
- #
-
- #
- # First, make sure "." is not in the path! Otherwise things like "sed"
- # can get screwed up when made in the corresponding sprite directory.
- #
- set path = (/sprite/cmds.$MACHINE /sprite/cmds)
- setenv MKMFDIR /sprite/lib/mkmf
- set dependall="pmake dependall"
- set depend="pmake depend"
- set userMap=()
- set sysMap=${MKMFDIR}/mkmf.map
- set defmachine=$MACHINE
- set distMap=${MKMFDIR}/mkmf.dist
- set machTypes=`grep -v "^#" /sprite/admin/machineTypes`
-
- #
- # No global flags by default.
- #
- setenv MKMFFLAGS
-
- #
- # If makeRCS is set, an RCS directory will be created should one not exist
- # If makeMd is set, a machine-dependent subdirectory will be created if
- # none exists already.
- #
- set makeRCS
- set makeMd
-
- #
- # Process options.
- #
- set i=1
- set makefile=Makefile
- set machinesToDo
- set noglob
- set usage = 'Usage: mkmf [-x] [-f file] [-mtm | -m tm]'
- unset noglob
-
-
- while ( $i <= $#argv )
- switch( "$argv[$i]" )
- #
- # Handle echoing
- #
- case "-x"
- set echo
- setenv MKMFFLAGS "$MKMFFLAGS -x"
- shift
- @@ i--
- breaksw
- #
- # Figure out alternate makefile if -f given
- #
- case "-f" :
- if ($i != $#argv) then
- shift
- set makefile=$argv[$i]
- shift
- @@ i--
- endif
- breaksw
- #
- # Build list of machine types to be done.
- #
- case "-m*" :
- set tmp = `echo "$argv[$i]" | sed "s/-m//"`
- if ("$tmp" == '') then
- if ($i != $#argv) then
- shift
- set machinesToDo = ($machinesToDo $argv[$i])
- unset dependall
- shift
- else
- echo "$usage"
- exit (1)
- endif
- else
- set machinesToDo = ($machinesToDo $tmp)
- unset dependall
- shift
- endif
- @@ i--
- breaksw
- default :
- echo "$usage"
- exit(1)
- breaksw
- endsw
- @@ i++
- end
-
- #
- # If the caller has a .mkmf file in his/her home directory, source it
- # now; this can be used to modify some of the controlling variables
- # above, like MKMFDIR and map.
- #
-
- if (-e ~/.mkmf) then
- source ~/.mkmf
- endif
-
- #
- # Check for permission to do this:
- # egrep -s returns 0 if a match is found for the pattern.
- # If a "no mkmf" comment is found in the current makefile, we refuse to run.
- # If no "allow mkmf" comment is in the current makefile, we must ask permission
- # before proceeding (if permission given, save the old Makefile in a
- # backup location, just in case).
- #
- #
- if (-e $makefile) then
- if ({ egrep -s '^#[ ]*[Nn]o mkmf' $makefile }) then
- echo "Sorry, mkmf not allowed in this directory"
- exit 1
- else if (! { egrep -s '^#[ ]*[Aa]llow mkmf' \
- $makefile }) then
- echo "WARNING: no '# Allow mkmf' in existing $makefile"
- echo -n "Ok to run mkmf? Enter 'y' if ok: "
- set a="$<"
- if ("$a" !~ [Yy]*) then
- echo "mkmf aborted"
- exit 1
- endif
- mv -f $makefile $makefile.~
- endif
- endif
-
- #
- # Determine what version of mkmf to run. Set $mkmf to contain that version name
- # Pass through mkmf.map looking for a line whose pattern matches the
- # current working directory and place the following fields into
- # 'ans'.
- #
-
- set ans=()
- if ( "$userMap" != "") set ans=(`echo $cwd | awk -f $userMap`)
- if ( "$ans" == "") set ans=(`echo $cwd | awk -f $sysMap`)
- set distdir=()
- if ( "$distMap" != "") set distdir=(`echo $cwd | nawk -f $distMap`)
- set mkmf=$ans[1]
- if ($ans[2] !~ [Yy]*) unset makeRCS
- if ($ans[3] !~ [Yy]*) then
- unset depend
- unset dependall
- endif
- if ($ans[4] !~ [Yy]*) unset makeMd
- setenv DISTDIR $distdir
- setenv SUBTYPE $ans[5]
- #
- # This is a kludge because the machine types "sun4c" and "ds5000" are
- # only visible in the kernel sources.
- #
- if ($ans[5] == "kernel") then
- set machTypes=($machTypes "sun4c" "ds5000")
- endif
-
- setenv MKMF ${MKMFDIR}/mkmf.$mkmf
- if (-x mkmf.local && ! -d mkmf.local) then
- echo "Using mkmf.local"
- set uselocal
- endif
-
- #
- # Create RCS directory if it should be here but isn't
- #
- if ((! -e RCS) && $?makeRCS) then
- echo "Making RCS directory."
- mkdir RCS
- endif
-
- #
- # Create ".md" directories (if they don't already exist) for those
- # machine types specified with the "-m" option. Also check that the
- # machine types are valid.
- #
- if ("$machinesToDo" != "") then
- set tmp=""
- foreach i ($machinesToDo)
- if (! -e $i.md) then
- if (" $machTypes " =~ *\ $i\ *) then
- echo "Making $i.md directory."
- mkdir $i.md
- chmod 775 $i.md
- set tmp=($tmp $i)
- else
- echo "$i isn't a valid machine type."
- endif
- else
- set tmp=($tmp $i)
- endif
- end
- if ("$tmp" == "") then
- exit 1
- else
- set machinesToDo=($tmp)
- endif
- endif
-
- #
- # Locate machine-dependent subdirectories (*.md) and set the environment
- # variable MACHINES to hold the names of the machines that we are to run
- # mkmf for, and ALLMACHINES to the names of all possible machine
- # types (without the ".md"suffixes).
- # If no machine-dependent subdirectories exist, create one
- # if that's permitted.
- #
- set nonomatch
- set mds=(*.md)
- unset nonomatch
- set machines
- set domachines
- if ("$mds" != "*.md") then
- foreach i ($mds)
- set machName = $i:r
- if ("$machinesToDo" == "" || \
- " $machinesToDo " =~ *\ $machName\ *) then
- set domachines = ($domachines $machName)
- endif
- set machines = ($machines $machName)
- end
- else
- if ( $?makeMd ) then
- echo "Making $defmachine.md directory."
- mkdir $defmachine.md
- if ("$machinesToDo" == "" || \
- " $machinesToDo " =~ *\ $defmachine\ *) then
- set machines=($defmachine)
- set domachines=($defmachine)
- endif
- endif
- endif
- setenv MACHINES "$machines"
- setenv DOMACHINES "$domachines"
-
- #
- # Store the name of the makefile we're manipulating in the MAKEFILE
- # envariable and invoke the appropriate version of mkmf
- #
- setenv MAKEFILE $makefile
- if ($?uselocal) then
- eval ./mkmf.local $MKMFFLAGS $*
- else
- eval ${MKMFDIR}/mkmf.$mkmf $MKMFFLAGS $*
- endif
-
- #
- # if a .sed file exists for the makefile, muck with it some more
- #
- if (-e $makefile.sed) then
- echo "Modifying with $makefile.sed."
- mv $makefile{,.$$~~}
- sed -f $makefile.sed $makefile.$$~~ > $makefile
- rm $makefile.$$~~
- endif
-
- #
- # if a .ex file exists for the makefile, edit the makefile using the .ex file
- # as a command script
- #
- if (-e $makefile.ex) then
- echo "Modifying with $makefile.ex."
- ex - $makefile < $makefile.ex
- endif
-
- #
- # Form dependencies for the makefile if required
- #
- if ($?dependall) then
- eval $dependall
- else if ($?depend) then
- foreach i ($domachines)
- eval $depend TM=$i
- end
- endif
-
- exit 0
- @
-
-
- 1.15
- log
- @added ds5000
- @
- text
- @d4 1
- a4 1
- # $Header: /sprite/src/cmds/mkmf.prog/RCS/mkmf,v 1.14 91/04/11 14:08:17 kupfer Exp $
- d79 1
- a79 1
- if ($tmp == '') then
- d188 1
- a188 1
- if ($machinesToDo != "") then
- d204 1
- a204 1
- if ($tmp == "") then
- @
-
-
- 1.14
- log
- @Get rid of DEFTARGET: the default target type is now set by a pmake
- library file (at "make" time).
- @
- text
- @d4 1
- a4 1
- # $Header$
- d162 2
- a163 2
- # This is a kludge because the machine type "sun4c" is only visible in
- # the kernel sources.
- d166 1
- a166 1
- set machTypes=($machTypes "sun4c")
- @
-
-
- 1.13
- log
- @allows -m with unknown machine type
- @
- text
- @d4 2
- a245 6
- if ( "$machines" =~ *\ *) then
- # multiple machines
- setenv DEFTARGET '\$(MACHINE)'
- else
- setenv DEFTARGET $machines
- endif
- @
-
-
- 1.12
- log
- @creates the .md directory if it doesn't exist
- @
- text
- @d189 2
- a190 2
- if (" $machTypes " =~ *\ $i\ *) then
- if (! -e $i.md) then
- d194 3
- d198 1
- a199 2
- else
- echo "$i isn't a valid machine type."
- @
-
-
- 1.11
- log
- @Changes for distribution.
- @
- text
- @d24 1
- d159 8
- d179 26
- @
-
-
- 1.10
- log
- @look for mkmf.local instead of mkmf
- @
- text
- @d23 1
- d147 2
- d156 1
- @
-
-
- 1.9
- log
- @reinstated DEFTARGET, which we use after all and had been checked in
- under a branch by mistake. and then added the defmachine fix again.
- @
- text
- @d155 2
- a156 2
- if (-x mkmf && ! -d mkmf) then
- echo "Using copy of mkmf in $cwd"
- d216 1
- a216 1
- eval ./mkmf $MKMFFLAGS $*
- @
-
-
- 1.8
- log
- @changed defmachine to $MACHINE.
- @
- text
- @d22 1
- a22 1
- set defmachine=${MACHINE}
- d203 6
- @
-
-
- 1.7
- log
- @removed DEFTARGET -- we use $MACHINE now.
- @
- text
- @d22 1
- a22 1
- set defmachine=sun3
- @
-
-
- 1.6
- log
- @Pick default machine from list of available machines.
- @
- text
- @a202 5
- if ( " $machines " =~ *\ $defmachine\ *) then
- setenv DEFTARGET $defmachine
- else
- setenv DEFTARGET $machines[1]
- endif
- @
-
-
- 1.6.1.1
- log
- @default TM to single directory if it exists, else to $MACHINE
- @
- text
- @d203 2
- a204 3
- if ( "$machines" =~ *\ *) then
- # multiple machines
- setenv DEFTARGET '\$(MACHINE)'
- d206 1
- a206 1
- setenv DEFTARGET $machines
- @
-
-
- 1.5
- log
- @can now do -mtm
- @
- text
- @a22 1
- setenv DEFTARGET $defmachine
- d203 5
- @
-
-
- 1.4
- log
- @added ability to do selected machine types
- @
- text
- @d44 3
- d48 1
- d50 1
- d54 6
- a59 6
- if ("$argv[$i]" == "-x") then
- set echo
- setenv MKMFFLAGS "$MKMFFLAGS -x"
- shift
- @@ i--
- endif
- d63 8
- a70 6
- if (("$argv[$i]" == "-f") && ($i != $#argv)) then
- shift
- set makefile=$argv[$i]
- shift
- @@ i--
- endif
- d74 24
- a97 8
- if (("$argv[$i]" == "-m") && ($i != $#argv)) then
- shift
- set machinesToDo = ($machinesToDo $argv[$i])
- shift
- unset dependall
- @@ i--
- endif
-
- @
-
-
- 1.3
- log
- @Slight change to last rev.
- @
- text
- @d18 2
- a19 1
- set depend="pmake dependall"
- d23 1
- d43 2
- d64 11
- d126 4
- a129 1
- if ($ans[3] !~ [Yy]*) unset depend
- d148 4
- a151 2
- # variable MACHINES to hold the names of the machines (without the ".md"
- # suffixes). If no machine-dependent subdirectories exist, create one
- d158 1
- d161 6
- a166 1
- set machines = ($machines $i:r)
- d172 5
- a176 1
- set machines=($defmachine)
- d180 1
- d215 6
- a220 2
- if ($?depend) then
- eval $depend
- @
-
-
- 1.2
- log
- @Don't keep backup Makefile unless the old Makefile wasn't
- automatically generated.
- @
- text
- @d95 1
- a95 1
- mv -f $makefile $makefile.$$~
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d78 2
- a79 1
- # before proceeding.
- d95 1
- d152 2
- a153 2
- # Backup old makefile, then store the name of the makefile we're manipulating
- # in the MAKEFILE envariable and invoke the appropriate version of mkmf
- a154 1
- if (-e $makefile) mv -f $makefile $makefile.$$~
- @
-